<template>
  <div>
    <!--引用表格-->
   <BasicTable @register="registerTable" >
      <template #form-createTimeSlot="{model,field}">
            <a-range-picker @change="onRangeChange" valueFormat="YYYY-MM-DD HH:mm:ss">
            </a-range-picker>
      </template>
      <template #form-createTimeEndSlot="{model,field}">
            <a-range-picker v-show="false" @change="onRangeChange" valueFormat="YYYY-MM-DD HH:mm:ss">
            </a-range-picker>
      </template>
     <!--插槽:table标题-->
      <template #tableTitle>
         <!-- <a-button  type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> -->
 
      </template>
       <!--操作栏-->
      <!-- <template #action="{ record }">
        <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
      </template> -->
      <!--字段回显插槽-->
      <template v-slot:bodyCell="{ column, record, index, text }">
      </template>
    </BasicTable>

  </div>
</template>

<script lang="ts" name="acrulechangerecord-acRuleChangeRecord" setup>
  import {ref, reactive, computed, unref} from 'vue';
  import {BasicTable, useTable, TableAction} from '/@/components/Table';
  import {useModal} from '/@/components/Modal';
  import { useListPage } from '/@/hooks/system/useListPage'
  import {columns, searchFormSchema} from './AcRuleChangeRecord.data';
  import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AcRuleChangeRecord.api';
  import { downloadFile } from '/@/utils/common/renderUtils';
  import { useUserStore } from '/@/store/modules/user';
  import { toRaw } from '@vue/reactivity';

  const queryParam = reactive<any>({});
  const checkedKeys = ref<Array<string | number>>([]);
  const userStore = useUserStore();

  //注册table数据
  const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
      tableProps:{
           title: '调度规则变更记录表',
           api: list,
           columns,
           canResize:false,
           showActionColumn:false,
           formConfig: {
              //labelWidth: 120,
              schemas: searchFormSchema,
              autoSubmitOnEnter:true,
              showAdvancedButton:true,
              fieldMapToNumber: [
              ],
              fieldMapToTime: [
                 ['createTime', ['createTimeBegin', 'createTimeEnd'], 'YYYY-MM-DD'],
              ],
            },
           actionColumn: {
               width: 120,
               fixed:'right'
            },
            beforeFetch: (params) => {
              return Object.assign(params, queryParam);
            },
      },
       exportConfig: {
            name:"调度规则变更记录表",
            url: getExportUrl,
            params: queryParam,
          }
          
  })

  const [registerTable, {reload,getForm,}] = tableContext

//  async  function onRangeChange(e){
//     console.log(e)
//     if(e.length==0) return
//      let { getFieldsValue,setFieldsValue, } =  getForm()
//     let data = getFieldsValue()
//     data.createTimeEnd  = e[1]
//     data.createTimeBegin  = e[0]
//     console.log(data)
//     await setFieldsValue(data)
//   }
  
   /**
    * 详情
   */
  function handleDetail(record: Recordable) {
     openModal(true, {
       record,
       isUpdate: true,
       showFooter: false,
     });
   }
  


</script>

<style scoped>

</style>
